Skip to content

Add Multicall3 deployment and pagination support for Ethscriptions#134

Merged
RogerPodacter merged 2 commits into
evm-backend-demofrom
improve_reading
Nov 4, 2025
Merged

Add Multicall3 deployment and pagination support for Ethscriptions#134
RogerPodacter merged 2 commits into
evm-backend-demofrom
improve_reading

Conversation

@RogerPodacter

@RogerPodacter RogerPodacter commented Nov 4, 2025

Copy link
Copy Markdown
Member
  • Implemented the deployment of the Multicall3 contract in L2Genesis.
  • Introduced pagination structures and methods in the Ethscriptions contract for efficient batch queries.
  • Added tests for Multicall3 functionality, including deployment verification and mixed call scenarios.
  • Enhanced error handling for pagination limits and added relevant constants.

Note

Adds Multicall3 as a predeploy in L2 genesis and introduces paginated Ethscriptions query endpoints with size limits, with comprehensive tests.

  • Genesis/Predeploys:
    • Deploy Multicall3 in L2Genesis.s.sol via new deployMulticall3() and call it during setup.
    • Add Predeploys.MultiCall3 address and embedded MultiCall3Code bytecode.
  • Ethscriptions Contract:
    • Add pagination: PaginatedEthscriptionsResponse struct, getEthscriptions(start, limit[, includeContent]), getOwnerEthscriptions(owner, start, limit[, includeContent]).
    • Add max page limits (MAX_PAGE_WITH_CONTENT=50, MAX_PAGE_WITHOUT_CONTENT=1000) and InvalidPaginationLimit error.
    • Implement internal paginator _createPaginatedEthscriptionsResponse supporting optional content inclusion.
  • Tests:
    • Multicall3.t.sol: verify deployment and batch calls (mixed success/failure).
    • Pagination gas/limits: PaginationGas.t.sol, PaginationGas1000.t.sol, PaginationGas1000Simple.t.sol for page sizes, clamping, and edge cases.

Written by Cursor Bugbot for commit 7d61c9f. This will update automatically on new commits. Configure here.

- Implemented the deployment of the Multicall3 contract in L2Genesis.
- Introduced pagination structures and methods in the Ethscriptions contract for efficient batch queries.
- Added tests for Multicall3 functionality, including deployment verification and mixed call scenarios.
- Enhanced error handling for pagination limits and added relevant constants.
@RogerPodacter RogerPodacter requested a review from Copilot November 4, 2025 19:10
cursor[bot]

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Multicall3 support and pagination helpers to the Ethscriptions protocol. The main purpose is to enable efficient batch querying of ethscriptions data, improving the developer experience for off-chain clients and indexers.

  • Deploys Multicall3 at the canonical address for batch contract calls
  • Adds pagination functions to query ethscriptions globally or by owner
  • Includes comprehensive test coverage for Multicall3 integration

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
contracts/test/Multicall3.t.sol New test suite validating Multicall3 deployment and batch querying of ethscriptions
contracts/src/libraries/Predeploys.sol Adds Multicall3 predeploy address constant and bytecode for deployment
contracts/src/Ethscriptions.sol Implements pagination helpers with configurable limits and includeContent flags
contracts/script/L2Genesis.s.sol Integrates Multicall3 deployment into genesis state setup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -18,6 +18,8 @@ library Predeploys {
/// @notice ProxyAdmin predeploy (manages all proxy upgrades)
address constant PROXY_ADMIN = 0x4200000000000000000000000000000000000018;

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing NatSpec documentation for the MultiCall3 constant. Other constants in this file have /// @notice comments explaining their purpose. Add documentation such as: /// @notice Multicall3 predeploy (canonical multicall contract for batched calls)

Suggested change
/// @notice Multicall3 predeploy (canonical multicall contract for batched calls)

Copilot uses AI. Check for mistakes.
uint160(uint256(uint160(_addr)) & 0xffff | uint256(uint160(0xc0D3C0d3C0d3C0D3c0d3C0d3c0D3C0d3c0d30000)))
);
}

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing NatSpec documentation for the MultiCall3Code constant. Add a comment explaining what this bytecode represents, such as: /// @notice Compiled bytecode for the Multicall3 contract deployment

Suggested change
/// @notice Compiled bytecode for the Multicall3 contract deployment

Copilot uses AI. Check for mistakes.
Comment on lines +116 to +117
/// @dev Maximum page sizes for pagination helpers
uint256 private constant MAX_PAGE_WITH_CONTENT = 50;

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing NatSpec documentation explaining why these specific page size limits were chosen. Consider adding comments that explain the rationale (e.g., gas limits, response size considerations) for these magic numbers.

Suggested change
/// @dev Maximum page sizes for pagination helpers
uint256 private constant MAX_PAGE_WITH_CONTENT = 50;
/// @dev Maximum page sizes for pagination helpers
/**
* @dev Maximum page size for pagination when content is included.
* Chosen as 50 to balance between gas cost and response size, ensuring
* that returning content for each item does not exceed block gas limits
* or cause out-of-gas errors in typical use cases.
*/
uint256 private constant MAX_PAGE_WITH_CONTENT = 50;
/**
* @dev Maximum page size for pagination when content is NOT included.
* Set to 1000 since omitting content allows for much larger page sizes
* without risking excessive gas usage or response size. This value was
* chosen to support efficient bulk queries while remaining safe for on-chain execution.
*/

Copilot uses AI. Check for mistakes.
@RogerPodacter RogerPodacter requested a review from Copilot November 4, 2025 19:57
@RogerPodacter

Copy link
Copy Markdown
Member Author

bugbot run

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}

function testGas_CheckLimitsWork() public view {

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function testGas_CheckLimitsWork is marked as view but uses require statements for assertions. In Forge tests, require should be replaced with assertLe from the Test contract for proper test failure reporting and consistency with other test files that use assertEq, assertTrue, etc.

Copilot uses AI. Check for mistakes.
// Test without content - should clamp at 1000
result = ethscriptions.getEthscriptions(0, 5000, false);
console.log("Requested 5000 without content, got:", result.items.length);
require(result.items.length <= 1000, "Should clamp to 1000");

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace require with assertLe(result.items.length, 1000, \"Should clamp to 1000\") for consistent test assertion patterns. The Forge testing framework provides dedicated assertion functions that give better error messages and integrate properly with test runners.

Suggested change
require(result.items.length <= 1000, "Should clamp to 1000");
assertLe(result.items.length, 1000, "Should clamp to 1000");

Copilot uses AI. Check for mistakes.
// Test with content - should clamp at 50
result = ethscriptions.getEthscriptions(0, 500, true);
console.log("Requested 500 with content, got:", result.items.length);
require(result.items.length <= 50, "Should clamp to 50");

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace require with assertLe(result.items.length, 50, \"Should clamp to 50\") for consistent test assertion patterns. The Forge testing framework provides dedicated assertion functions that give better error messages and integrate properly with test runners.

Suggested change
require(result.items.length <= 50, "Should clamp to 50");
assertLe(result.items.length, 50, "Should clamp to 50");

Copilot uses AI. Check for mistakes.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


@RogerPodacter RogerPodacter merged commit 33dc2cb into evm-backend-demo Nov 4, 2025
9 checks passed
@RogerPodacter RogerPodacter deleted the improve_reading branch November 4, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants